import request from '@/utils/request';



export async function pageBug(projectId, params) {
    return request(`/project/${projectId}/bug/page`, {
        params,
    });
}

export async function save(projectId, data) {
    return request(`/project/${projectId}/bug`, {
        method: "POST",
        data: data
    });
}

export async function update(projectId, bugId, data) {
    return request(`/project/${projectId}/bug/${bugId}`, {
        method: "POST",
        data: data
    });
}

export async function getDetail(projectId, bugId) {
    return request(`/project/${projectId}/bug/${bugId}`);
}

export async function deleteBug(projectId, bugId) {
    return request(`/project/${projectId}/bug/${bugId}`, {
        method: "DELETE",
    });
}

export async function updateIsArchived(projectId, bugId, isArchived) {
    return request(`/project/${projectId}/bug/${bugId}/${isArchived}`, {
        method: "POST",
    });
}

export async function confirm(projectId, bugId, data) {
    return request(`/project/${projectId}/bug/${bugId}/confirm`, {
        method: "POST",
        data: data
    });
}

export async function fix(projectId, bugId, data) {
    return request(`/project/${projectId}/bug/${bugId}/fix`, {
        method: "POST",
        data: data
    });
}

export async function changeToUser(projectId, bugId, data) {
    return request(`/project/${projectId}/bug/${bugId}/changeToUser`, {
        method: "POST",
        data: data
    });
}

export async function closeBug(projectId, bugId, data) {
    return request(`/project/${projectId}/bug/${bugId}/close`, {
        method: "POST",
        data: data
    });
}

export async function activeBug(projectId, bugId, data) {
    return request(`/project/${projectId}/bug/${bugId}/active`, {
        method: "POST",
        data: data
    });
}